package com.example.treeutil.layer;

import com.example.treeutil.datasource.Service;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;


import java.util.Date;
import java.util.List;

/**
 * 2024/12/13
 * 图层资源目录上的具体图层，有可能是WMS、WMTS、或其它格式的
 * @author fengyu
 */
@NodeType(value = NodeType.TYPE.SERVICE)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ResourceLayer implements TreeNode<Integer, String, ResourceLayer> {
    // 有类型，即能够让前端知道加载的是什么服务格式的图层
    private Integer id;

    // 这里的title主要用在前端显示服务名称
    private String title;

    private MuLu catelog;

    private int index;

    // 是否随初始化加载到底图上
    private boolean show;

    // 数据时间
    private Date dataDate;

    private Service layer;

    @Override
    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    // 直接给前端转json格式不忽略这个get会导致无限循环，一般转出vo对象，以pid方式指定目录id
    @JsonIgnore
    public MuLu getCatelog() {
        return catelog;
    }

    public void setCatelog(MuLu catelog) {
        this.catelog = catelog;
    }

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public boolean isShow() {
        return show;
    }

    public void setShow(boolean show) {
        this.show = show;
    }

    public Date getDataDate() {
        return dataDate;
    }

    public void setDataDate(Date dataDate) {
        this.dataDate = dataDate;
    }

    public Service getLayer() {
        return layer;
    }

    public void setLayer(Service layer) {
        this.layer = layer;
    }

    @Override
    public String getPId() {
        if (null == catelog) return null;
        return catelog.getId();
    }

    @Override
    public List<ResourceLayer> getSubs() {
        return null;
    }
}
